Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@elastic/apm-rum

Package Overview
Dependencies
Maintainers
0
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elastic/apm-rum

Elastic APM JavaScript agent

  • 5.16.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created

What is @elastic/apm-rum?

@elastic/apm-rum is an Elastic APM Real User Monitoring (RUM) agent for JavaScript applications. It helps you monitor the performance of your web applications by collecting and sending performance metrics and errors to the Elastic APM server.

What are @elastic/apm-rum's main functionalities?

Initialize APM

This code initializes the APM agent with the specified service name, server URL, and environment. It sets up the agent to start collecting performance metrics and errors.

const apm = require('@elastic/apm-rum').init({
  serviceName: 'my-service',
  serverUrl: 'http://localhost:8200',
  environment: 'production'
});

Capture Page Load Metrics

This code starts a transaction for capturing page load metrics. It helps in measuring the time taken for the page to load completely.

apm.startTransaction('page-load', 'page-load');

Capture Custom Transactions

This code demonstrates how to capture custom transactions. You can start a transaction, perform some operations, and then end the transaction to measure the time taken for those operations.

const transaction = apm.startTransaction('custom-transaction', 'custom');
// Perform some operations
transaction.end();

Capture Errors

This code captures errors and sends them to the APM server. It helps in monitoring and debugging issues in your application.

try {
  // Some code that might throw an error
} catch (error) {
  apm.captureError(error);
}

Other packages similar to @elastic/apm-rum

FAQs

Package last updated on 27 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc